package jp.ac.aiit.yc.softarch.hbcp.service.common;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;


public class DBSample {

	public static void main(String[] args) throws Exception{

		Class.forName("org.hsqldb.jdbcDriver");

		Connection connection = DriverManager.getConnection("jdbc:hsqldb:file:/HBCP_DB/hbcp_dbFile;shutdown=true", "sa", null);
		Statement stmt = connection.createStatement();

//		ResultSet rs = stmt.executeQuery("insert into user values('kojima','mizuki')");
//		ResultSet rs = stmt.executeQuery("select * from user");
		ResultSet rs = stmt.executeQuery("select max(id) as maxid from CARDOPHISTORY");

		while(rs.next()) {
			System.out.print(rs.getString("maxid"));

		}
//		while(rs.next()) {
//		System.out.print(rs.getString("title"));
//		System.out.print("\t");
//		System.out.print(rs.getString("content"));
//		System.out.print("\t");
//		System.out.print(rs.getString("uid"));
//		System.out.print("\t");
//		System.out.print(rs.getInt("x"));
//		System.out.print("\t");
//		System.out.print(rs.getInt("y"));
//		System.out.print("\t");
//		System.out.println(rs.getString("owner"));
//	}



		rs.close();
		stmt.close();
		connection.close();
	}
}
